import React, { Suspense } from "react";
import { BrowserRouter, useRoutes } from 'react-router-dom'
const Home = React.lazy(() => import("../views/home"));
const Order = React.lazy(() => import("../views/order"));
const PayResult = React.lazy(() => import("../views/payResult"));

const routes = [
  {
    path: "/",
    element: <Home></Home>,
  },
  {
    path: "/order",
    element: <Order></Order>,
  },
  {
    path: "/pay/result",
    element: <PayResult></PayResult>,
  },
];

const Router = () => {
  const RouterView = () => useRoutes(routes)
  return (
    <BrowserRouter>
      <Suspense>
        <RouterView></RouterView>
      </Suspense>
    </BrowserRouter>
  )

}


export default Router
